<%@ page import="com.tour.bean.Consumer" %><%--
  Created by IntelliJ IDEA.
  Date: 2020/3/15
  Time: 16:29
  To change this template use File | Settings | File Templates.
  顶部导航栏
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    Consumer consumer= (Consumer) request.getSession().getAttribute("userInfo");
    String username="";
    if (consumer!=null){
        username=consumer.getNickName();
        int userid=consumer.getId();
    }
%>
<script type="text/javascript">
    $(function () {
        const user="<%=consumer%>";
        if (!Util.nvl(user)){
            $("#divUserSuccess").show();
            $("#divUserLogin").hide();
            $("#s-username").text("<%=username%>")
        }else{
            $("#divUserLogin").show();
            $("#divUserSuccess").hide();
        }

        $("#logout").click(function () {
            Util.get("/Consumer/userLogout","",function () {
                window.location.reload();
            })
        })
    });

</script>
<!-- Fixed navbar -->
<nav class="navbar navbar-default navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <a class="navbar-brand" style="font-size: 33px;color: #0000ff;font-family: cursive" href="<%=path%>/">云游旅行</a>
        </div>
        <div  class="navbar-collapse collapse">
            <ul class="nav navbar-nav" style="font-size: 19px">
                <li><a href="<%=path%>/index">主页</a></li>
                <li><a href="<%=path%>/scenic_spot/list">景点</a></li>
                <li><a href="<%=path%>/hotel/list">酒店</a></li>
                <li><a href="<%=path%>/ticket/list">票务</a></li>

            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li class="active" id="divUserLogin" style="display: none"><a href="#"data-toggle="modal" data-target="#loginMoadl">登录 <span class="sr-only">登录</span></a></li>
                <li class="active" id="divUserSuccess" style="display: none">
                    <a class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span id="s-username"></span>
                        <span class="sr-only"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a href="<%=path%>/user/center" target="_blank">个人中心</a></li>
                        <li><a href="#" id="logout">退出</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
</nav>